<template>
    <div>
      <mt-header fixed title="留言反馈">
        <router-link to="/" slot="left">
          <mt-button icon="back" @click="$router.back(-1)">返回</mt-button>
        </router-link>
      </mt-header>
      <div class="art-box">
        <textarea class="feedback-box" maxlength="200"  placeholder="请输入留言信息，不超过200字" v-model="feedback_content"></textarea>
        <mt-button type="danger" class="submit-btn" @click="submitData()">提交</mt-button>
      </div>
    </div>
</template>

<script>
export default {
  name: 'Feedback',
  data () {
    return {
      feedback_content:''
    }
  },
  created(){
    
  },
  methods:{
    submitData(){
      var params = new URLSearchParams();
      params.append('feedback_content', this.feedback_content);       //你要传给后台的参数值 key/value
      this.$axios({
          method: 'post',
          url:'feedBack',
          data:params
      }).then((res)=>{
          if(res.data.code==0){
            this.$messagebox.alert('反馈成功', '提示');
          }else{
            this.$messagebox.alert(res.data.msg,'提示');
          }
      }).catch(err=>{
        console.log(err);
      });
    }
  }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style>
  .art-box{
    margin-top: 40px;
  }
  .art-box{
    padding: 10px;
  }
  .art-box img{
    width: 100% !important;
    height: auto;
  }
  .feedback-box{
    padding: 10px;
    width: 100%;
    height: 250px;
    outline: none;
  }
  .submit-btn{
    margin-top: 10px;
    width: 80%;
    margin-left: 10%;
  }

</style>
